<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      /* 
      em是相对于元素的字体大小来计算的
      1em = 1font-size
      em会随着字体的大小改变二改变

      rem是相对根元素（html）的字体大小来计算的
      
    */
      body {
        font-size: 14px;
      }
      .box1 {
        width: 2em;
        height: 2em;
        background-color: skyblue;
      }
      .box2 {
        width: 4em;
        height: 4em;
        background-color: springgreen;
      }
      /* .box3 {
        font-size: 30px;
        width: 6em;
        height: 6em;
        background-color: orange;
      } */
      .box3 {
        font-size: 30px;
        width: 6rem;
        height: 6rem;
        background-color: orange;
      }
    </style>
  </head>
  <body>
    <div class="box1"></div>
    <div class="box2"></div>
    <div class="box3"></div>
  </body>
</html>
